(function () {
    return {
        "u": function (v) {
            var ret="";
            var s = v.replace(/\r\n/g, "\n").split("\n");
            for (var i = 0; i < s.length; i++) {
                str = s[i];
                ret+=this.uncode(str)+"<br/>";
            }
            return ret;
        },
        "uncode":function(str){
            var out="";
            
            do{
                st = str.indexOf("###");
                if (st > 0){
                    ss = substring(st+3);
                    out=out+"<div class='md_code'>"+ss+"</div>";
                    break;
                }
                str = str.indexOf("//")

            }while(false)
                return out;
        }
        ,
        "tag": function () {
            l=document.getElementsByTagName("md");
            if(l.length==0){
                return;
            }
            for(var i=0;i<l.length;i++){
                var c=this.u(l[i].innerHTML);
                l[i].before(c);
                l[i].remove();
            }
        },
        "style":function(){
            var str="<style>";
            str=str+" .md_code{"+this.css("code");
            str=str+"}";

            str=str+"</style>";
            return str;
        }
        ,
        "css": function (type) {
            switch (type) {
                case "code":
                    return "font-style:italic;background-color:#f3f3f3;color:#555;font-weight:lighter;font-size:small;padding:10px;";
            }
        }
    }
}())